package net.groupme.utils.sql;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Vector;

import javax.sql.DataSource;

import org.springframework.jdbc.object.MappingSqlQuery;


public class GetAllActions extends MappingSqlQuery {
	private DataSource datasource;
	private String columnName;
	public GetAllActions(DataSource ds, String query) {
        super(ds, query);
        this.datasource = ds;
    
        compile();
    }

    protected Vector<String[]> mapRow(ResultSet rs, int rowNum) throws SQLException {
        Vector<String[]> actions = new Vector<String[]>();
         while (!rs.isAfterLast()){
        	String[]action = new String[6];
           action[0]= rs.getString("userId");
           action[1]= rs.getString("groupId");
           action[2]= rs.getString("resourceId");
           action[3]= rs.getString("tagId");
           action[4]= rs.getString("action");
           action[5]= rs.getTimestamp("timeAndDate").getTime()+"";
           
           
        	actions.add(action);
        	 rs.next();
        }
    	return actions; 
    }

}
